package oop.method;

/**
 * Created with IntelliJ IDEA.
 * ClassName: MethodTest
 * Package: oop.method
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-10
 * Time: 21:42
 */

public class MethodTest {
    public static void main(String[] args) {

    }
}


class Person {

    //属性
    String name;
    int age;
    char gender;

    //方法
    public void eat() {
        System.out.println("人吃饭");
    }

    public void sleep(int hour) {
        System.out.println("人每天至少睡眠" + hour + "小时");
    }

    public String interests(String hobby) {
        String info = "我的爱好是" + hobby;
        System.out.println(info);
        return info;
    }

    public int getAge(){
        return age;
    }


}